<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<jsp:include page="/cnbdw/commons/device.jsp"/>
<script type="text/javascript">
    //页面加载完后响应 onReady
    $(function(){
    var empId=$('#empId').val();
    
  //  alert(empId+"???");
	    //初始化主列表
	    $('#bind-datagrid').datagrid({
	        url: '${pageContext.request.contextPath}/employeeAction!removeDeviceDatasource.action?empId='+empId,
	        
	        border: false,
	        fitColumns: true,
	        height: 200,
	        pagination: false,
	        striped: true,
	        columns: [
	            [
					{field: 'id', checkbox: true},
					{field: 'cardNum', title: '设备名称', align: 'left', formatter: function (value, rowData, rowIndex) {if (value == '') {return '--'} return value;}},
					{field: 'hardwareNo', title: '设备标识', align: 'left', formatter: function (value, rowData, rowIndex) {if (value == '') {return '--'} return value;}},
					{field: 'deviceNo', title: '设备mac', align: 'left', formatter: function (value, rowData, rowIndex) {if (value == '') {return '--'} return value;}},
					{field: 'deviceType', title: '设备类型', align: 'left', 
					   
					    	 formatter: function (value, row, index) {
                    	var html="----"
                    	html = getDeviceTypeName(value);
                        return html;
                    }
					   
					},
					 {field: 'deviceState', title: '设备状态', align: 'left', 
                    formatter: function (value, row, index) {
                    	var html="----"
                    	html = getDeviceStateName(value);
                        return html;
                    }
                },
					{field: 'createTime', title: '创建时间', align: 'left', formatter: function (value, rowData, rowIndex) {if (value == '') {return '--'} return value;}},
			  		{field: 'createUser', title: '创建人员', align: 'left', formatter: function (value, rowData, rowIndex) {if (value == '') {return '--'} return value;}},
	                {field: 'action', title: '人员操作', align: 'right',
                      formatter: function (value, row, index) {
                        var html = "";
                        
                        html += '<span  style="cursor:pointer" onclick="doEditDatasource(\'' + row.id + '\')"><img  src="${pageContext.request.contextPath}/images/icons/modify_or_edit.png" title="修改" alt="修改"/>修改&nbsp;&nbsp;</span>';
                        
     
                        return html;
                    }
                }
	            ]
	        ]
	    });
    });

//修改数据源配置信息窗口
function doEditDatasource(id) {
    $('<div id="addDiv1"/>').dialog({
        href: '${pageContext.request.contextPath}/cnbdw/deviceAction!toEditPage.action?id=' + id,
        top: 100,
        width: 500,
        modal: true,
        title: '修改设备',
        buttons: [
            {
                id: 'btnSave',
                text: '保存',
                iconCls: '',
                handler: function () {
                    var d = $(this).closest('.window-body');
                    $('#form').form('submit', {
                        url: '${pageContext.request.contextPath}/cnbdw/deviceAction!update.action',
                        onSubmit: function () {
                            if ($(this).form("validate")) {
                                $.messager.progress({title: '提示', text: '正在保存，请稍候 ....'});
                            } else {
                                return false;
                            }
                        },
                        success: function (result) {
                            try {
                                var r = $.parseJSON(result);
                                if (r.returnFlag) {
                                    $('#bind-datagrid').datagrid('reload');
                                    d.dialog('destroy');
                                }
                                //显示提示信息
                                $.messager.show({
                                    title: '提示',
                                    msg: r.returnMsg
                                });
                            } catch (e) {
                            }
                            $.messager.progress('close');
                        }
                    });
                }
            },
            {
                id: 'btnCancle',
                text: '取消',
                iconCls: '',
                handler: function () {
                    $(this).closest('.window-body').dialog('destroy');
                }
            }
        ],
        onClose: function () {
            $(this).dialog('destroy');
            //刷新主列表
            $('#bind-datagrid').datagrid('reload');
        }
    });
}


</script>
<input type="hidden" id="empId" value="${emp}" />

 <span class="required"></span>退绑原因:&nbsp;        
    <input type="text" id="reason" name="reason" style="width:400px;" maxlength="200"  class="easyui-validatebox" />
          
<table id="bind-datagrid"></table>




